//
//  LoginView.m
//  DiceGame
//
//  Created by 航汇聚科技 on 2017/8/8.
//  Copyright © 2017年 Yi Zhou. All rights reserved.
//

#import "LoginView.h"

#import "Masonry.h"

#import "MacroDefinition.h"

/**
 * 登录视图中 textField类型
 */
typedef NS_ENUM(NSInteger, LoginTextFieldType) {
    ///账号
    LoginTextFieldType_Account = 1000,
    ///密码
    LoginTextFieldType_Password
};

@interface LoginView ()<UITextFieldDelegate>

/*
 @property inputAccountTextField
 @abstract 账号输入框TextField
 */
@property (weak, nonatomic) IBOutlet UITextField *inputAccountTextField;

/*
 @property inputPasswordTextField
 @abstract 密码输入框TextField
 */
@property (weak, nonatomic) IBOutlet UITextField *inputPasswordTextField;


/*
 @property loginButton
 @abstract 登录Button
 */
@property (weak, nonatomic) IBOutlet UIButton *loginButton;


@end

@implementation LoginView

- (void)awakeFromNib {
    [super awakeFromNib];
    self.inputAccountTextField.tag = LoginTextFieldType_Account;
    self.inputPasswordTextField.tag = LoginTextFieldType_Password;
}

#pragma mark - button action
- (IBAction)touchLoginBackgroundAction:(UIButton *)sender {
    YLog(@"点击登录背景");
}
- (IBAction)loginAction:(UIButton *)sender {
    YLog(@"登录");
}


#pragma mark - UITextFieldDelegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    return [textField resignFirstResponder];
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
    NSString *inputResult = textField.text;
    switch (textField.tag) {
        case LoginTextFieldType_Account:
            YLog(@"%@",inputResult);
            break;
        case LoginTextFieldType_Password:
            YLog(@"%@",inputResult);
            break;
        default:
            break;
    }
}






@end
